package com.rhb.detector.topsec.domain.model;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.apache.poi.hssf.usermodel.HSSFRow;

import com.rhb.detector.topsec.application.util.Tools;

public class QosInterfaceTraffic {
	private List<Rate> rates;
	private Date madeDate;

	public Date getMadeDate() {
		return madeDate;
	}

	public QosInterfaceTraffic(String str) {
		rates = new ArrayList();
		madeDate = new Date();
		
		str = str.replace(" ", "");
		str = str.replace("\r\n", "");
		str = str.replace("\n", "");

		List<String> l = Tools.subStrings(str, "<td>|</td>");
		
		rates.add(new Rate(l.get(19)));
		rates.add(new Rate(l.get(49)));
	}
	
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append(Tools.getDate(madeDate, "yyyy-MM-dd hh:mm:ss"));
		sb.append(",   ");
		for (Rate r : rates) {
			sb.append(r.toString());
			sb.append(", ");
		}
		sb.append("\n");
		return sb.toString();
	}
	
	public List<Rate> getRates() {
		return rates;
	}

	public void setRates(List<Rate> rates) {
		this.rates = rates;
	}

	public void setMadeDate(Date madeDate) {
		this.madeDate = madeDate;
	}
	
}
